package com.example.asus.a222dzd_ordering.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.example.asus.a222dzd_ordering.R;


public class ConfirmOrderActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView tv_confirm_username,tv_confirm_time,tv_confirm_sum;
    private EditText et_confirm_address,et_confirm_num;
    private Button bt_confirm_submit;
    private SharedPreferences sharedPreferences;
    private String foodname,username;
    private int foodprice,foodid,userid,num;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_confirm_order);
        initView();
        initEvent();
        initData();
    }

    private void initView(){
        tv_confirm_username = findViewById(R.id.tv_confirm_username);
        tv_confirm_time = findViewById(R.id.tv_confirm_time);
        et_confirm_num = findViewById(R.id.et_confirm_num);
        tv_confirm_sum = findViewById(R.id.tv_confirm_sum);
        et_confirm_address = findViewById(R.id.et_confirm_address);
        bt_confirm_submit = findViewById(R.id.bt_confirm_submit);
    }

    private void initEvent(){

    }

    private void initData(){
        Intent intent = getIntent();
        foodid = intent.getIntExtra("foodid",0);
        foodprice = intent.getIntExtra("foodprice",0);
        foodname = intent.getStringExtra("foodname");
        userid = intent.getIntExtra("userid",0);
        sharedPreferences = getSharedPreferences("User",MODE_PRIVATE);
        username = sharedPreferences.getString("username","用户名读取失败");

        tv_confirm_username.setText(username);

    }

    @Override
    public void onClick(View v) {

    }
}
